var menuLength=getLength("config_page_size");
var btnModel = '    \
	{{#each func}}\
    <button type="button" class="{{this.type}} btn-sm" onclick="{{this.fn}}">{{this.name}}</button>\
    {{/each}}';
	var template = Handlebars.compile(btnModel);
	var staffdataTableConfig={
			"ordering" : false,// 排序
			"serverSide" : true,// 开启服务器模式
			"scrollX" : true,// 横向滚动
			ajax : {
				"type" : "POST",
				"url" : '../log/logList',//请求路径
				"contentType" : 'application/x-www-form-urlencoded; charset=UTF-8',
				"dataType":"json",
				"data" :  function(d) {// 查询参数
					d.operAccount = $('#operAccountObj').val();
					d.operIp = $('#operIpObj').val();
					d.operPermissionName = $('#operPermissionNameObj').val();
					d.operUrl = $('#operUrlObj').val();
					d.operStatus = $('#operStatusObj').val();
					d.operTime = $('#starOperTimeObj').val();
					d.endOperTime = $('#endOperTimeObj').val();
					return d;
				}
			},
			columns : [// 对应列
	           	{"data" : "operAccount",title:"操作者账户",render : $.fn.dataTable.render.ellipsis(22, true)}, 
				{"data" : "operIp",title:"操作者IP",render : $.fn.dataTable.render.ellipsis(22, true)},
				{"data" : "operHostIp",title:"项目主机IP",render : $.fn.dataTable.render.ellipsis(22, true)}, 
				{"data" : "operPermissionName",title:"操作功能模块",render : $.fn.dataTable.render.ellipsis(22, true)},
				{"data" : "operUrl",title:"模块URL",render : $.fn.dataTable.render.ellipsis(22, true)},
				{"data" : "operTime",title:"操作时间",render : $.fn.dataTable.render.ellipsis(22, true)},
				{"data" : "operTotalTime",title:"操作耗时",render : $.fn.dataTable.render.ellipsis(22, true)},
				{"data" : "operParameter",title:"参数值",render :$.fn.dataTable.render.ellipsis(22, true)},
				{"data" : "operStatus",title:"操作结果",render : function(data, type, full, meta) {
					if (data == 1) {
						return "成功";
					} else {
						return "失败";
					}
				}}
	           ],
			"columnDefs" : [ {// 所有列默认值
				"targets" : "_all",
				"defaultContent" : ''
				} ],
				"dom" : 'rt<"floatl mt5"l><"floatl mt5"i><"floatr mt5"p><"clear">',//生成样式
				"lengthMenu": [
				        menuLength,
				        menuLength
				    ]
	};
	//查询，重新载入表格
	function reloadLog() {
		$("#logTable").dataTable().fnDraw(false);
	}
	$(function() {
		 $("#logTable").DataTable(staffdataTableConfig);
	})
